<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title> Topo Demo </title>

<script type="text/javascript" src="topo/MainTopo.js"></script>
<script type="text/javascript" src="topo/Test.js"></script>
</head>
<body>
	<canvas id="topoCanvas" width="100" height="100">
		
	</canvas>
	
	<script type="text/javascript">
	
		var bodyW = document.documentElement.clientWidth,
		bodyH = document.documentElement.clientHeight;
		var _canvas = document.getElementById("topoCanvas");
		_canvas.width = bodyW;
		_canvas.height = bodyH;
		
		var option = {
				canvasId : "topoCanvas",
				backGround : "images/background.png",
				animateFlag : true , 
				layout : {
					name : "none"
				},
				
				nodes : [
 					{
						type : "circle",
						x : 500,
						y : 80,
						radius : 20,
						labelText : "192.168.1.1",
						showLabel : false
					} ,
					{
						type : "img",
						x : 550,
						y : 80,
						labelText : "192.168.1.2",
						imgName : "images/dev.png",
						width:55,
						height:55
					} ,
					{
						type : "rect",
						x : 650,
						y : 80,
						labelText : "192.168.1.3"
					},
					{
						type : "udRender",
						x : 750,
						y : 80,
						labelText : "192.168.1.4",
						renderMethod : function (g2d,node){
							g2d.beginPath();
							
							var x = node.x;
							var y = node.y;
							var w = node.width;
							var h = node.height;
							g2d.moveTo(x + w/2,y);
							g2d.lineTo(x,y+h);
							g2d.lineTo(x+w,y+h);
							g2d.lineTo(x + w/2,y);
							
							g2d.closePath();

							g2d.fillStyle = node.fillColor;
							if(node.needDrawSelected()){
								g2d.fillStyle = node.focusColor;
							}
							g2d.fill();
						}
					} 
				],
				edges : []
		}
		
		var topoObj = new NMSTopo.Topo(option);
		topoObj.initAndShowTopo(); 
		
/* 		
 *  alert(NMSTopo.STATE_IMAGE_LOAD);
 *  var test = new Test.TestClass("这是一个测试");
	test.doTest2(); 
 */
	</script>
</body>
</html>